
<template>
<!-- 佣金实际结算记录 -->
<div>
   <el-table v-if="tableData3.length>0" :data="tableData3" border  >          
            <el-table-column prop="COMPANYBROKERAGE_ID" label="id" width="180">
            </el-table-column>           
            <el-table-column prop="COMPANYBROKERAGE_TIME" label="导出时间" width="180" :formatter="localDataFomatter">
            </el-table-column>
            <el-table-column prop="COMPANYBROKERAGE_MONEY" label="系统建议应结佣金" width="180" >
            </el-table-column>
            <el-table-column prop="COMPANYBROKERAGE_UPSURPLUS" label="上次剩余佣金" width="200">
            </el-table-column>
              <el-table-column prop="COMPANYBROKERAGE_CSURPLUS" label="本次剩余佣金" width="200">
            </el-table-column>
            <el-table-column prop="COMPANYBROKERAGE_SURPLUS" label="系统建议总剩余佣金" width="200">
            </el-table-column>
            <el-table-column prop="COMPANYBROKERAGE_MONEYREAL" label="实际结算佣金" width="200">
            </el-table-column>
            <el-table-column prop="COMPANYBROKERAGE_SURPLUSREAL" label="实际佣金剩余" width="200">
            </el-table-column>               
               <el-table-column label="操作" width="200" fixed="right" >
                <template scope="scope">
                    <el-button type="text" size="media" @click="goChange(scope.row)"  v-if="!scope.row.COMPANYBROKERAGE_MONEYREAL">
                        <i class="el-icon-view"> 确认</i>
                    </el-button>
                </template>
            </el-table-column>             
        </el-table>
          <div class="block">
            <el-pagination @current-change="handleCurrentChange" :current-page="currentPage1" :page-size="10" layout="total, prev, pager, next" :total="pagecount">
            </el-pagination>
        </div>
         <el-dialog title="修改投保单" :visible.sync="changeShow"  v-if="changeShow"  >
           <el-form ref="form" :model="moneyObj" label-width="200px">
           <el-form-item label="实际结算佣金">
                <el-input v-model="moneyObj.COMPANYBROKERAGE_MONEYREAL"></el-input>
                 </el-form-item>
                   <el-form-item label="实际剩余佣金">
                <el-input v-model="moneyObj.COMPANYBROKERAGE_SURPLUSREAL"></el-input>
                 </el-form-item>
                  <el-form-item>
     <el-button type="primary" @click="onSubmit">确定</el-button>   
         </el-form-item>
           </el-form>
         </el-dialog>
        </div>
</template>
<script>
import api from "@/js/api";
export default {
  data() {
    return {
      currentPage1: 1,
      pagecount: 0,
      tableData3: [],
      changeShow: false,
      moneyObj: {
        COMPANYBROKERAGE_ID: "",
        COMPANYBROKERAGE_MONEYREAL: "",
        COMPANYBROKERAGE_SURPLUSREAL: ""
      }
    };
  },
  methods: {
    //时间过滤器
    localDataFomatter(row, column, cellValue) {
      //   cellValue = cellValue + "Z";
      var data = new Date(cellValue);
      var dataString =
        data.getFullYear() +
        "/" +
        ((data.getMonth() + 1)>=10?(data.getMonth() + 1):"0"+(data.getMonth() + 1)) +
        "/" +
        (data.getDate()>=10?data.getDate():"0"+data.getDate()) +
        " " +
        (data.getHours()>=10?data.getHours():"0"+data.getHours())+
        ":" +
        (data.getMinutes()>=10?data.getMinutes():"0"+ data.getMinutes());
      return dataString;
    },
    onSubmit(id) {
      let that = this;
      var obj = {
        COMPANYBROKERAGE_MONEYREAL: this.moneyObj.COMPANYBROKERAGE_MONEYREAL,
        COMPANYBROKERAGE_SURPLUSREAL: this.moneyObj.COMPANYBROKERAGE_SURPLUSREAL,
        COMPANYBROKERAGE_ID: this.moneyObj.COMPANYBROKERAGE_ID
      };
      api.GetCOMPANYBROKERAGEUpdate(that, obj, function(msg) {
        that.$notify.success({
          title: "成功",
          message: "修改成功"
        });
        that.changeShow = false;
         that.getDate();
      });
    },
    //分页
    handleCurrentChange(vule) {
      // console.log(vule);
      this.currentPage1 = vule;
      this.getDate();
    }, //获取数据
    getDate() {
      let that = this;
      var data = {
        pageIndex: this.currentPage1,
        pageSize: 10
      };
      api.GetCOMPANYBROKERAGEList(that, data, function(msg) {
        that.tableData3 = msg.Result;
        that.pagecount = msg.ListCount;
      });
    },
    goChange(obj) {
      this.changeShow = true;
      //   this.moneyObj.COMPANYBROKERAGE_MONEY =
      //     obj.moneyObj.COMPANYBROKERAGE_MONEY;
      this.moneyObj.COMPANYBROKERAGE_ID = obj.COMPANYBROKERAGE_ID;
      this.moneyObj.COMPANYBROKERAGE_MONEYREAL = "";
      this.moneyObj.COMPANYBROKERAGE_SURPLUSREAL = "";
    }
  },
  activated() {
    this.getDate();
  }
};
</script>

<style>

</style>
